package com.xjy.rpcconsume.service;

import com.xjy.rpc.annotation.ServerRegister;
import com.xjy.rpc.bean.BeanDefinition;
import com.xjy.test.ITestController;

import java.lang.reflect.AnnotatedType;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;

@ServerRegister
public class testService implements ITestController {

    public String hello(){
        int i = 1/0;
        return "hello";
    }

    public String server(){
        return "server";
    }


    public BeanDefinition testMethod(String msg, Integer count){
        return new BeanDefinition();
    }

    public static void main(String[] args) throws NoSuchMethodException {
        Method hello = testService.class.getDeclaredMethod("testMethod",String.class,Integer.class);
        String methodName = hello.getName();

        AnnotatedType annotatedReturnType = hello.getAnnotatedReturnType();

        //方法修饰符
        int modifiers = hello.getModifiers();
        //方法是否有可变参数
        boolean varArgs = hello.isVarArgs();
        //返回该方法所在类
        Class<?> declaringClass = hello.getDeclaringClass();

        Parameter[] parameters = hello.getParameters();

        Class<?> returnType = hello.getReturnType();
    }

}
